﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;

namespace DefeatEpidemic.Models
{
    public class Application
    {
        public Guid id { get; set; } = Guid.NewGuid();
        /// <summary>
        /// 申请人
        /// </summary>
        [StringLength(20)]
        [Display(Name = "申请人")]
        public string applicant { get; set; }
        /// <summary>
        /// 从哪来
        /// </summary>
        [Display(Name = "从哪来")]
        [StringLength(50)]
        public string from { get; set; }
        /// <summary>
        /// 到哪去
        /// </summary>
        [StringLength(50)]
        [Display(Name = "到哪去")]
        public string to { get; set; }
        /// <summary>
        /// 联系方式
        /// </summary>
        [StringLength(20)]
        [Display(Name = "联系方式")]
        public string connect { get; set; }
        /// <summary>
        /// 是否开车，0-不开，1-开
        /// </summary>
        [Display(Name = "是否开车")]
        public int isDirve { get; set; } = 0;
        /// <summary>
        /// 车牌号
        /// </summary>
        [Display(Name = "车牌号")]
        [StringLength(10)]
        public string carNumber { get; set; }
        /// <summary>
        /// 出行人数
        /// </summary>
        [Display(Name = "出行人数")]
        public int outNumber { get; set; }
        /// <summary>
        /// 审批状态，0-未审批，1-审批通过，2-审批不通过
        /// </summary>
        [Display(Name = "审批状态")]
        public int status { get; set; }
        /// <summary>
        /// 自测体温
        /// </summary>
        [Display(Name = "自测体温")]
        public float selfTemp { get; set; }
        /// <summary>
        /// 实测体温
        /// </summary>
        [Display(Name = "实测体温")]
        public float measuredTemp { get; set; }
        /// <summary>
        /// 原因
        /// </summary>
        [Display(Name = "审批原因")]
        [StringLength(200)]
        public string reason { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        [Display(Name = "备注")]
        [StringLength(200)]
        public string remark { get; set; }
        /// <summary>
        /// 申请的出行时间
        /// </summary>
        [Display(Name = "出行时间")]
        public DateTime outTime { get; set; } = DateTime.Now;
        /// <summary>
        /// 申请时间
        /// </summary>
        [Display(Name = "申请时间")]
        public DateTime created_at { get; set; } = DateTime.Now;

        /// <summary>
        /// 标识码
        /// </summary>

        public string labelNumber { get; set; } = "a" + Common.Tools.GenerateInviteCode(7);

        /// <summary>
        /// 二维码地址
        /// </summary>
        public string url
        {
            get
            {
                return "https://defeat.cdn.bcebos.com/virus/" + id.ToString("N") + ".jpg";
            }
        }
        /// <summary>
        /// 审查人员id
        /// </summary>
        public Guid checker_id { get; set; }

        public virtual Member member { get; set; }
    }
}
